package com.fgs.common.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.fgs.common.R;
import com.fgs.common.entity.region.RegionInfo;

import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
import org.yczbj.ycrefreshviewlib.holder.BaseViewHolder;

/**
 * @author fgs
 * @date 2021/5/27
 * @description
 **/
public class CitySearchAdapter extends RecyclerArrayAdapter<RegionInfo> {
    public CitySearchAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new CitySearchViewHolder(parent, R.layout.item_city_search);
    }

    private class CitySearchViewHolder extends BaseViewHolder<RegionInfo> {

        private TextView textView;

        public CitySearchViewHolder(ViewGroup parent, int res) {
            super(parent, res);
            textView = getView(R.id.item_city_search_textView);
        }

        @Override
        public void setData(RegionInfo data) {
            super.setData(data);
            textView.setText(data.label);
        }
    }
}
